package org.pentaho.cubic.client.service;

import java.util.*;

import org.pentaho.cubic.client.objects.SimpleMessageException;
import org.pentaho.cubic.client.objects.SolutionFileInfo;
import org.pentaho.cubic.client.objects.SubscriptionSchedule;
import org.pentaho.cubic.client.objects.SubscriptionState;
import org.pentaho.cubic.client.objects.WorkspaceContent;
import org.pentaho.platform.api.usersettings.pojo.IUserSetting;

import com.google.gwt.user.client.rpc.RemoteService;

public interface ICubicService extends RemoteService {
	  public boolean isAuthenticated();
	  public boolean isAdministrator();
	  public boolean cancelBackgroundJob(String jobName, String jobGroup);
	  public boolean deleteContentItem(String contentId);
	  
	  public String getSoftwareUpdatesDocument();
	  
	  // admin
	  public void executeGlobalActions();
	  public String refreshMetadata();
	  public void refreshSystemSettings();
	  public void refreshRepository();
	  public int cleanContentRepository(int daysBack);
	  public void flushMondrianSchemaCache();
	  public void purgeReportingDataCache();

	  //schedule API
	  public void createCronJob(String solutionName, String path, String actionName, String triggerName, String triggerGroup, String description, String cronExpression) throws SimpleMessageException;
	  public void createSimpleTriggerJob(String triggerName, String triggerGroup, String description, Date strStartDate, Date strEndDate, int repeatCount, int strRepeatInterval,
	      String solutionName, String path, String actionName) throws SimpleMessageException;
	  public void suspendJob(String jobName, String jobGroup);
	  public void resumeJob(String jobName, String jobGroup);
	  public void deleteJob(String jobName, String jobGroup);
	  public void runJob(String jobName, String jobGroup);
	  
	  //subscriptions API
	  public Boolean isSubscriptionContent(String actionRef);
	  public ArrayList<SubscriptionSchedule> getAvailableSubscriptionSchedules(String actionRef);
	  public ArrayList<SubscriptionSchedule> getAppliedSubscriptionSchedules(String actionRef);
	  public void setSubscriptions(String solutionName, String solutionPath, String fileName, boolean enabled, ArrayList<SubscriptionSchedule> currentSchedules);
	  public SubscriptionState getSubscriptionState(String solutionName, String solutionPath, String fileName);
	  public String deleteSubscriptionArchive(String subscriptionName, String fileId);
	  public String deletePublicScheduleAndContents(String currSubscr, ArrayList<String> fileItemArrayList);    
	  public String runAndArchivePublicSchedule(String publicScheduleName) throws SimpleMessageException;
	  public WorkspaceContent getWorkspaceContent();
	  
	  // file api
	  public SolutionFileInfo getSolutionFileInfo(String solutionName, String path, String fileName);
	  public void setSolutionFileInfo(SolutionFileInfo fileInfo) throws SimpleMessageException;
	  public ArrayList<String> getAllUsers();
	  public ArrayList<String> getAllRoles();
	  public boolean doesSolutionRepositorySupportPermissions();
	  public boolean hasAccess(String solutionName, String path, String fileName, int actionOperation);
	  
	  // mantle settings
	  public HashMap<String,String> getMantleSettings();

	  // version information
	  public String getVersion();
	  
	  // For New Analysis View
	  public HashMap<String,ArrayList<String[]>> getMondrianCatalogs();  
	  
	  // user settings
	 // public ArrayList<IUserSetting> getUserSettings();
	  public void setLocaleOverride(String locale);
	  // generic user settings
	  public void setUserSetting(String settingName, String settingValue) throws SimpleMessageException;
	  //public IUserSetting getUserSetting(String settingName) throws SimpleMessageException;
	  public void setShowNavigator(boolean showNavigator);
	  public void setShowLocalizedFileNames(boolean showLocalizedFileNames);
	  public void setShowHiddenFiles(boolean showHiddenFiles);
	  
	  public boolean repositorySupportsACLS();
	  
	  //public ArrayList<MantleXulOverlay> getOverlays();
	  
	  //public Map<String, String> getSystemThemes();
	  //public String getActiveTheme();
	  //public void setTheme(String theme) throws SimpleMessageException;
}
